package com.jinyang.jetpackdemo;

/**
 * @Author: LiuJinYang
 * @CreateDate: 2022/1/5
 * @Description:
 */
class ClassLoaderTest {
    public static void main(String[] args) {
        System.out.println("boot.class.path: " + System.getProperty("sun.boot.class.path"));
        System.out.println("java.ext.dirs: " + System.getProperty("java.ext.dirs"));
        ClassLoader loader = new MyClassLoader();
        while (loader != null) {
            System.out.println("loader:" + loader);
            loader = loader.getParent();
        }
        MyClassLoader classLoader1 = new MyClassLoader();
        MyClassLoader2 classLoader2 = new MyClassLoader2();
        try {
            System.out.println("ClassLoaderTest1:" + classLoader1.loadClass(MyClassLoader.class.getName()).hashCode());
            System.out.println("ClassLoaderTest2:" + classLoader2.loadClass(MyClassLoader.class.getName()).hashCode());
        } catch (ClassNotFoundException e) {
            System.out.println("ClassNotFoundException:" + e.getLocalizedMessage());
        }
    }

    public static class MyClassLoader extends ClassLoader {

    }
    public static class MyClassLoader2 extends ClassLoader {

    }
}
